﻿using System.Collections.Generic;
using Core.Common;

namespace Poker
{
    public class PokerCard
    {
        protected PokerCard() { }

        /// <summary>
        /// 花色
        /// </summary>
        public PokerColor Color { get; protected set; }
        /// <summary>
        /// 牌面数字
        /// </summary>
        public PokerSuit Suit { get; protected set; }

        /// <summary>
        /// 全部的黑桃牌
        /// </summary>
        public static ICollection<PokerCard> SpadesPokerCards => new HashSet<PokerCard> { SpadesA, Spades2, Spades3, Spades4, Spades5, Spades6, Spades7, Spades8, Spades9, Spades10, SpadesJ, SpadesQ, SpadesK };
        /// <summary>
        /// 全部的红桃牌
        /// </summary>
        public static ICollection<PokerCard> HeartsPokerCards => new HashSet<PokerCard> { HeartsA, Hearts2, Hearts3, Hearts4, Hearts5, Hearts6, Hearts7, Hearts8, Hearts9, Hearts10, HeartsJ, HeartsQ, HeartsK };
        /// <summary>
        /// 全部的梅花牌
        /// </summary>
        public static ICollection<PokerCard> ClubsPokerCards => new HashSet<PokerCard> { ClubsA, Clubs2, Clubs3, Clubs4, Clubs5, Clubs6, Clubs7, Clubs8, Clubs9, Clubs10, ClubsJ, ClubsQ, ClubsK };
        /// <summary>
        /// 全部的方块牌
        /// </summary>
        public static ICollection<PokerCard> DiamondsPokerCards => new HashSet<PokerCard> { DiamondsA, Diamonds2, Diamonds3, Diamonds4, Diamonds5, Diamonds6, Diamonds7, Diamonds8, Diamonds9, Diamonds10, DiamondsJ, DiamondsQ, DiamondsK };

        /// <summary>
        /// 小王
        /// </summary>
        public static PokerCard BlackJoker = new BlackJoker();
        /// <summary>
        /// 大王
        /// </summary>
        public static PokerCard RedJoker = new RedJoker();

        #region 黑桃牌
        public static PokerCard SpadesA = new SpadesPokerCard { Suit = PokerSuit.Ace };
        public static PokerCard Spades2 = new SpadesPokerCard { Suit = PokerSuit.Two };
        public static PokerCard Spades3 = new SpadesPokerCard { Suit = PokerSuit.Three };
        public static PokerCard Spades4 = new SpadesPokerCard { Suit = PokerSuit.Four };
        public static PokerCard Spades5 = new SpadesPokerCard { Suit = PokerSuit.Five };
        public static PokerCard Spades6 = new SpadesPokerCard { Suit = PokerSuit.Six };
        public static PokerCard Spades7 = new SpadesPokerCard { Suit = PokerSuit.Seven };
        public static PokerCard Spades8 = new SpadesPokerCard { Suit = PokerSuit.Eight };
        public static PokerCard Spades9 = new SpadesPokerCard { Suit = PokerSuit.Nine };
        public static PokerCard Spades10 = new SpadesPokerCard { Suit = PokerSuit.Ten };
        public static PokerCard SpadesJ = new SpadesPokerCard { Suit = PokerSuit.Jack };
        public static PokerCard SpadesQ = new SpadesPokerCard { Suit = PokerSuit.Queen };
        public static PokerCard SpadesK = new SpadesPokerCard { Suit = PokerSuit.King };
        #endregion

        #region 红桃牌
        public static PokerCard HeartsA = new HeartsPokerCard { Suit = PokerSuit.Ace };
        public static PokerCard Hearts2 = new HeartsPokerCard { Suit = PokerSuit.Two };
        public static PokerCard Hearts3 = new HeartsPokerCard { Suit = PokerSuit.Three };
        public static PokerCard Hearts4 = new HeartsPokerCard { Suit = PokerSuit.Four };
        public static PokerCard Hearts5 = new HeartsPokerCard { Suit = PokerSuit.Five };
        public static PokerCard Hearts6 = new HeartsPokerCard { Suit = PokerSuit.Six };
        public static PokerCard Hearts7 = new HeartsPokerCard { Suit = PokerSuit.Seven };
        public static PokerCard Hearts8 = new HeartsPokerCard { Suit = PokerSuit.Eight };
        public static PokerCard Hearts9 = new HeartsPokerCard { Suit = PokerSuit.Nine };
        public static PokerCard Hearts10 = new HeartsPokerCard { Suit = PokerSuit.Ten };
        public static PokerCard HeartsJ = new HeartsPokerCard { Suit = PokerSuit.Jack };
        public static PokerCard HeartsQ = new HeartsPokerCard { Suit = PokerSuit.Queen };
        public static PokerCard HeartsK = new HeartsPokerCard { Suit = PokerSuit.King };
        #endregion

        #region 梅花牌
        public static PokerCard ClubsA = new ClubsPokerCard { Suit = PokerSuit.Ace };
        public static PokerCard Clubs2 = new ClubsPokerCard { Suit = PokerSuit.Two };
        public static PokerCard Clubs3 = new ClubsPokerCard { Suit = PokerSuit.Three };
        public static PokerCard Clubs4 = new ClubsPokerCard { Suit = PokerSuit.Four };
        public static PokerCard Clubs5 = new ClubsPokerCard { Suit = PokerSuit.Five };
        public static PokerCard Clubs6 = new ClubsPokerCard { Suit = PokerSuit.Six };
        public static PokerCard Clubs7 = new ClubsPokerCard { Suit = PokerSuit.Seven };
        public static PokerCard Clubs8 = new ClubsPokerCard { Suit = PokerSuit.Eight };
        public static PokerCard Clubs9 = new ClubsPokerCard { Suit = PokerSuit.Nine };
        public static PokerCard Clubs10 = new ClubsPokerCard { Suit = PokerSuit.Ten };
        public static PokerCard ClubsJ = new ClubsPokerCard { Suit = PokerSuit.Jack };
        public static PokerCard ClubsQ = new ClubsPokerCard { Suit = PokerSuit.Queen };
        public static PokerCard ClubsK = new ClubsPokerCard { Suit = PokerSuit.King };
        #endregion

        #region 方块牌
        public static PokerCard DiamondsA = new DiamondsPokerCard { Suit = PokerSuit.Ace };
        public static PokerCard Diamonds2 = new DiamondsPokerCard { Suit = PokerSuit.Two };
        public static PokerCard Diamonds3 = new DiamondsPokerCard { Suit = PokerSuit.Three };
        public static PokerCard Diamonds4 = new DiamondsPokerCard { Suit = PokerSuit.Four };
        public static PokerCard Diamonds5 = new DiamondsPokerCard { Suit = PokerSuit.Five };
        public static PokerCard Diamonds6 = new DiamondsPokerCard { Suit = PokerSuit.Six };
        public static PokerCard Diamonds7 = new DiamondsPokerCard { Suit = PokerSuit.Seven };
        public static PokerCard Diamonds8 = new DiamondsPokerCard { Suit = PokerSuit.Eight };
        public static PokerCard Diamonds9 = new DiamondsPokerCard { Suit = PokerSuit.Nine };
        public static PokerCard Diamonds10 = new DiamondsPokerCard { Suit = PokerSuit.Ten };
        public static PokerCard DiamondsJ = new DiamondsPokerCard { Suit = PokerSuit.Jack };
        public static PokerCard DiamondsQ = new DiamondsPokerCard { Suit = PokerSuit.Queen };
        public static PokerCard DiamondsK = new DiamondsPokerCard { Suit = PokerSuit.King };
        #endregion

        /// <summary>
        /// 牌面值
        /// </summary>
        /// <returns></returns>
        public override string ToString() => Color.GetEnumDisplayName() + Suit.GetEnumDisplayName();
    }

    /// <summary>
    /// 黑桃牌
    /// </summary>
    public sealed class SpadesPokerCard : PokerCard
    {
        public SpadesPokerCard()
        {
            Color = PokerColor.Spades;
        }
    }

    /// <summary>
    /// 红桃牌
    /// </summary>
    public sealed class HeartsPokerCard : PokerCard
    {
        public HeartsPokerCard()
        {
            Color = PokerColor.Hearts;
        }
    }

    /// <summary>
    /// 梅花牌
    /// </summary>
    public sealed class ClubsPokerCard : PokerCard
    {
        public ClubsPokerCard()
        {
            Color = PokerColor.Clubs;
        }
    }

    /// <summary>
    /// 方块牌
    /// </summary>
    public sealed class DiamondsPokerCard : PokerCard
    {
        public DiamondsPokerCard()
        {
            Color = PokerColor.Diamonds;
        }
    }

    /// <summary>
    /// 大王
    /// </summary>
    public sealed class RedJoker : PokerCard
    {
        public RedJoker()
        {
            Color = PokerColor.Hearts;
            Suit = PokerSuit.Joker;
        }

        /// <summary>
        /// 牌面值
        /// </summary>
        /// <returns></returns>
        public override string ToString() => "大王";
    }

    /// <summary>
    /// 小王
    /// </summary>
    public sealed class BlackJoker : PokerCard
    {
        public BlackJoker()
        {
            Color = PokerColor.Spades;
            Suit = PokerSuit.Joker;
        }

        public override string ToString() => "小王";
    }
}
